﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EventManager.Model.Entites;
using EventManager.Model.Mappings;

namespace EventManager.Model.Factory
{
    public class EMDbContext : DbContext
    {
        public EMDbContext()
            : base("EventsManagerConnection")
        {
        }

        public DbSet<Events> Events { get; set; }
        public DbSet<Categories> Categories { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Configurations.Add(new EventsMappings());
            modelBuilder.Configurations.Add(new CategoriesMappings());
        }
    }
}
